import { useState } from 'react';

export const useInstructions = (): {
  visible: boolean;
  setVisible: (visible: boolean) => void;
  cheked: boolean;
  setCheked: (cheked: boolean) => void;
  showInstructions: () => boolean;
} => {
  const [visible, setVisible] = useState(false);
  const [cheked, setCheked] = useState(true);

  // 是否展示入住说明弹窗
  const showInstructions = () => {
    const needOpenCheckInModal = ['/racing/create'];
    if (
      needOpenCheckInModal.some((item) =>
        window.location.pathname.includes(item)
      )
    ) {
      return true;
    }
    return false;
  };

  return {
    visible,
    setVisible,
    cheked,
    setCheked,
    showInstructions,
  };
};
